home *** CD-ROM | disk | FTP | other *** search
- /*
- * GeoObject.h - class definition of abstract base class GeoObject
- * (parent to all geometric primitives).
- *
- * Copyright (C) 1992, Christoph Streit (streit@iam.unibe.ch)
- * University of Berne, Switzerland
- * All rights reserved.
- *
- * This software may be freely copied, modified, and redistributed
- * provided that this copyright notice is preserved on all copies.
- *
- * You may not distribute this software, in whole or in part, as part of
- * any commercial product without the express consent of the authors.
- *
- * There is no warranty or other guarantee of fitness of this software
- * for any purpose. It is provided solely "as is".
- *
- */
-
- #ifndef GeoObject_H
- # define GeoObject_H
-
- #include "Vector.h"
- #include "BoundingBox.h"
- #include "Polygon.h"
- #include "boolean.h"
- #include "list.h"
- #include "Ray.h"
-
- //___________________________________________________________ GeoObject
-
- class GeoObject
- {
- public:
- GeoObject();
- virtual ~GeoObject();
-
- virtual int intersect(const Ray&, real, real&)=0;
- Vector getNormal(const Vector&) const;
- virtual Vector normal(const Vector&) const =0;
- virtual PolygonList* tesselate(const BoundingBox&)=0;
-
- virtual int setTransform(TransMatrix*);
- TransMatrix* getTrans() const;
- TransMatrix* getInvTrans() const;
-
- static long getIntersectionTests();
- static long getIntersections();
-
- protected:
- TransMatrix* trans;
- TransMatrix* itrans;
- static long intersectionTests;
- static long intersections;
- };
-
- typedef GeoObject* GeoObjectPtr;
- declareList(GeoObjectList, GeoObjectPtr);
-
- inline TransMatrix* GeoObject::getTrans() const {
- return trans;
- }
-
- inline TransMatrix* GeoObject::getInvTrans() const {
- return itrans;
- }
-
- inline long GeoObject::getIntersectionTests() {
- return intersectionTests;
- }
-
- inline long GeoObject::getIntersections() {
- return intersections;
- }
-
- #endif // GeoObject_H
-
-